introduce domain_max_vcpus() helper and implement per arch
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 22 Jan 2015 11:44:03 +0000 (12:44 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 22 Jan 2015 11:44:03 +0000 (12:44 +0100)
This allows the common XEN_DOMCTL_max_vcpus handler to lose some x86-specific
architecture knowledge.

It turns out that Xen had the same magic number twice in-tree with different
names (HVM_MAX_VCPUS and MAX_HVM_VCPUS).  This removes all use of
MAX_HVM_VCPUS, and x86 uses HVM_MAX_VCPUS from the public headers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/common/domctl.c
xen/include/asm-arm/config.h
xen/include/asm-arm/domain.h
xen/include/asm-x86/config.h
xen/include/asm-x86/domain.h

index ee578c0042559aa85b29d5434bb8de80fbcec76e..33ecd454a0f1b78404397e0d7d0c0a7176b74b18 100644 (file)
@@ -608,8 +608,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 
         ret = -EINVAL;
         if ( (d == current->domain) || /* no domain_pause() */
-             (max > MAX_VIRT_CPUS) ||
-             (is_hvm_domain(d) && (max > MAX_HVM_VCPUS)) )
+             (max > domain_max_vcpus(d)) )
             break;
 
         /* Until Xenoprof can dynamically grow its vcpu-s array... */
index 1b5a842ce0af146f40a2891e2c6ad8f919c81dc4..3b23e0519d4a7e4b6144275688a2f29f8aab6698 100644 (file)
@@ -48,7 +48,6 @@
 #endif
 
 #define MAX_VIRT_CPUS 8
-#define MAX_HVM_VCPUS MAX_VIRT_CPUS
 
 #define asmlinkage /* Nothing needed */
 
index 8b7dd852741991b0a41db3e215b0b1fa5ea4f91a..9018c6a17c784a01050c753891486934482527de 100644 (file)
@@ -249,6 +249,11 @@ struct arch_vcpu
 void vcpu_show_execution_state(struct vcpu *);
 void vcpu_show_registers(const struct vcpu *);
 
+static inline unsigned int domain_max_vcpus(const struct domain *d)
+{
+    return MAX_VIRT_CPUS;
+}
+
 #endif /* __ASM_DOMAIN_H__ */
 
 /*
index ad52d5b94219d74c12db0c859cdf69c69218fd4e..2fbd68d0b44c9ac0fbc9b6f0642e3ffd389c89d2 100644 (file)
@@ -67,9 +67,6 @@
 #define NR_CPUS 256
 #endif
 
-/* Maximum we can support with current vLAPIC ID mapping. */
-#define MAX_HVM_VCPUS 128
-
 /* Linkage for x86 */
 #define __ALIGN .align 16,0x90
 #define __ALIGN_STR ".align 16,0x90"
index 6a77a930ad7ff8e608aeb0c7c7d24d786d229176..b233fbc2f0e8056748f93840270103a1f5a71634 100644 (file)
@@ -9,6 +9,7 @@
 #include <asm/e820.h>
 #include <asm/mce.h>
 #include <public/vcpu.h>
+#include <public/hvm/hvm_info_table.h>
 
 #define has_32bit_shinfo(d)    ((d)->arch.has_32bit_shinfo)
 #define is_pv_32bit_domain(d)  ((d)->arch.is_32bit_pv)
@@ -527,6 +528,8 @@ void domain_cpuid(struct domain *d,
                   unsigned int  *ecx,
                   unsigned int  *edx);
 
+#define domain_max_vcpus(d) (is_hvm_domain(d) ? HVM_MAX_VCPUS : MAX_VIRT_CPUS)
+
 #endif /* __ASM_DOMAIN_H__ */
 
 /*